#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <stdlib.h>

//https://www.nowcoder.com/share/jump/9466535261693451508743
int Add(int num1, int num2) {

}

// https://leetcode.cn/problems/find-all-numbers-disappeared-in-an-array/
int* findDisappearedNumbers(int* nums, int numsSize, int* returnSize) {
	for (int i = 0; i < numsSize - 1; i++) {
		for (int j = 0; j < numsSize - 1 - i; j++) {
			if (nums[j] > nums[j + 1]) {
				int t = nums[j];
				nums[j] = nums[j + 1];
				nums[j + 1] = t;
			}
		}
	}
	int* retNums = (int*)malloc(sizeof(int) * numsSize);
	*returnSize = 0;
	for (int i = 0; i < numsSize; i++) {
		if (nums[i] != i + 1) {
			int flag = 1;
			for (int j = i + 1; j < numsSize; j++) {
				if (nums[j] == i + 1) {
					flag = 0;
					break;
				}
			}
			if (flag) {
				retNums[(*returnSize)++] = i + 1;
			}
		}
	}
	return retNums;
}

int main() {
	//printf("%d", -(-(-1) ^ -(-2)));
	//printf("%d", -1 ^ 2);
	int nums[] = { 4,3,2,7,8,2,3,1 };
	int size = sizeof(nums) / sizeof(nums[0]),
		returnSize = 0;
	int * retNums = findDisappearedNumbers(nums, size, &returnSize);
	for (int i = 0; i < returnSize; i++) {
		printf("%d ", retNums[i]);
	}
	return 0;
}